package com.mornd.gulimall.apis.order;

import com.mornd.gulimall.apis.order.fallback.IOrderClientFallback;
import com.mornd.gulimall.apis.order.to.OrderPageTo;
import com.mornd.gulimall.apis.order.to.OrderTo;
import com.mornd.gulimall.common.core.result.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.constraints.NotBlank;

/**
 * @author: mornd
 * @dateTime: 2023/7/22 - 23:54
 */

@Validated
@FeignClient(value = "service-order", fallback = IOrderClientFallback.class)
public interface IOrderClient {

    /**
     * 根据订单号查询订单详情
     * @param orderSn
     * @return
     */
    @GetMapping("/order/feign/getOrderBySn")
    R<OrderTo> getOrderBySn(@RequestParam @NotBlank String orderSn);

    /**
     * 分页查询当前登录用户的订单信息
     * @param orderPageTo
     * @return
     */
    @PostMapping("/order/feign/pageOrderWithItemByUser")
    R<OrderPageTo> pageOrderWithItemByUser(@RequestBody @Validated OrderPageTo orderPageTo);
}
